package o;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources.NotFoundException;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.core.widget.TextViewCompat;
import com.huawei.appgallery.festivalanimation.particle.modifiers.SizeModifier;
import java.lang.ref.WeakReference;
import o.ah.g;
import o.fv.d;

public class cc {
    private cu ʻ;
    @NonNull
    private final ci ʼ;
    private int ʽ = 0;
    private final TextView ˊ;
    private cu ˋ;
    private cu ˎ;
    private cu ˏ;
    private boolean ˏॱ;
    private cu ॱ;
    private Typeface ॱॱ;
    private cu ᐝ;

    public cc(TextView textView) {
        this.ˊ = textView;
        this.ʼ = new ci(this.ˊ);
    }

    @SuppressLint({"NewApi"})
    public void ˏ(AttributeSet attributeSet, int i) {
        cw ˊ;
        boolean z;
        boolean z2;
        ColorStateList ॱ;
        ColorStateList ॱ2;
        ColorStateList colorStateList = null;
        Context context = this.ˊ.getContext();
        bx ˋ = bx.ˋ();
        cw ॱ3 = cw.ॱ(context, attributeSet, g.ʼᐝ, i, 0);
        int ॱॱ = ॱ3.ॱॱ(g.ʽˊ, -1);
        if (ॱ3.ᐝ(g.ˊʻ)) {
            this.ॱ = ˎ(context, ˋ, ॱ3.ॱॱ(g.ˊʻ, 0));
        }
        if (ॱ3.ᐝ(g.ʽˋ)) {
            this.ˎ = ˎ(context, ˋ, ॱ3.ॱॱ(g.ʽˋ, 0));
        }
        if (ॱ3.ᐝ(g.ˈॱ)) {
            this.ˏ = ˎ(context, ˋ, ॱ3.ॱॱ(g.ˈॱ, 0));
        }
        if (ॱ3.ᐝ(g.ʾॱ)) {
            this.ˋ = ˎ(context, ˋ, ॱ3.ॱॱ(g.ʾॱ, 0));
        }
        if (VERSION.SDK_INT >= 17) {
            if (ॱ3.ᐝ(g.ˉॱ)) {
                this.ᐝ = ˎ(context, ˋ, ॱ3.ॱॱ(g.ˉॱ, 0));
            }
            if (ॱ3.ᐝ(g.ʿॱ)) {
                this.ʻ = ˎ(context, ˋ, ॱ3.ॱॱ(g.ʿॱ, 0));
            }
        }
        ॱ3.ॱ();
        boolean z3 = this.ˊ.getTransformationMethod() instanceof PasswordTransformationMethod;
        if (ॱॱ != -1) {
            ˊ = cw.ˊ(context, ॱॱ, g.ۥ);
            if (z3 || !ˊ.ᐝ(g.ॱⁱ)) {
                z = false;
                z2 = false;
            } else {
                z2 = ˊ.ˋ(g.ॱⁱ, false);
                z = true;
            }
            ˊ(context, ˊ);
            if (VERSION.SDK_INT < 23) {
                if (ˊ.ᐝ(g.ॱߴ)) {
                    ॱ = ˊ.ॱ(g.ॱߴ);
                } else {
                    ॱ = null;
                }
                if (ˊ.ᐝ(g.ॱՙ)) {
                    ॱ2 = ˊ.ॱ(g.ॱՙ);
                } else {
                    ॱ2 = null;
                }
                if (ˊ.ᐝ(g.ॱߺ)) {
                    colorStateList = ˊ.ॱ(g.ॱߺ);
                }
            } else {
                ॱ2 = null;
                ॱ = null;
            }
            ˊ.ॱ();
        } else {
            ॱ2 = null;
            ॱ = null;
            z = false;
            z2 = false;
        }
        ˊ = cw.ॱ(context, attributeSet, g.ۥ, i, 0);
        if (!z3 && ˊ.ᐝ(g.ॱⁱ)) {
            z2 = ˊ.ˋ(g.ॱⁱ, false);
            z = true;
        }
        if (VERSION.SDK_INT < 23) {
            if (ˊ.ᐝ(g.ॱߴ)) {
                ॱ = ˊ.ॱ(g.ॱߴ);
            }
            if (ˊ.ᐝ(g.ॱՙ)) {
                ॱ2 = ˊ.ॱ(g.ॱՙ);
            }
            if (ˊ.ᐝ(g.ॱߺ)) {
                colorStateList = ˊ.ॱ(g.ॱߺ);
            }
        }
        if (VERSION.SDK_INT >= 28 && ˊ.ᐝ(g.ॱʹ) && ˊ.ˎ(g.ॱʹ, -1) == 0) {
            this.ˊ.setTextSize(0, 0.0f);
        }
        ˊ(context, ˊ);
        ˊ.ॱ();
        if (ॱ != null) {
            this.ˊ.setTextColor(ॱ);
        }
        if (ॱ2 != null) {
            this.ˊ.setHintTextColor(ॱ2);
        }
        if (colorStateList != null) {
            this.ˊ.setLinkTextColor(colorStateList);
        }
        if (!z3 && r0) {
            ˊ(z2);
        }
        if (this.ॱॱ != null) {
            this.ˊ.setTypeface(this.ॱॱ, this.ʽ);
        }
        this.ʼ.ˋ(attributeSet, i);
        if (is.ॱ && this.ʼ.ˎ() != 0) {
            int[] ˊ2 = this.ʼ.ˊ();
            if (ˊ2.length > 0) {
                if (((float) this.ˊ.getAutoSizeStepGranularity()) != SizeModifier.STABLE_STATE_SCALE) {
                    this.ˊ.setAutoSizeTextTypeUniformWithConfiguration(this.ʼ.ˏ(), this.ʼ.ˋ(), this.ʼ.ॱ(), 0);
                } else {
                    this.ˊ.setAutoSizeTextTypeUniformWithPresetSizes(ˊ2, 0);
                }
            }
        }
        cw ˊ3 = cw.ˊ(context, attributeSet, g.ˊʼ);
        int ˎ = ˊ3.ˎ(g.ͺˎ, -1);
        int ˎ2 = ˊ3.ˎ(g.ˏͺ, -1);
        int ˎ3 = ˊ3.ˎ(g.ͺˏ, -1);
        ˊ3.ॱ();
        if (ˎ != -1) {
            TextViewCompat.ˋ(this.ˊ, ˎ);
        }
        if (ˎ2 != -1) {
            TextViewCompat.ॱ(this.ˊ, ˎ2);
        }
        if (ˎ3 != -1) {
            TextViewCompat.ˏ(this.ˊ, ˎ3);
        }
    }

    private void ˊ(Context context, cw cwVar) {
        boolean z = true;
        this.ʽ = cwVar.ॱ(g.ॱٴ, this.ʽ);
        if (cwVar.ᐝ(g.ॱꜝ) || cwVar.ᐝ(g.ॱﹶ)) {
            this.ॱॱ = null;
            int i = cwVar.ᐝ(g.ॱﹶ) ? g.ॱﹶ : g.ॱꜝ;
            if (!context.isRestricted()) {
                final WeakReference weakReference = new WeakReference(this.ˊ);
                try {
                    this.ॱॱ = cwVar.ॱ(i, this.ʽ, new d(this) {
                        final /* synthetic */ cc ˊ;

                        public void ˎ(@NonNull Typeface typeface) {
                            this.ˊ.ˊ(weakReference, typeface);
                        }

                        public void ˋ(int i) {
                        }
                    });
                    if (this.ॱॱ != null) {
                        z = false;
                    }
                    this.ˏॱ = z;
                } catch (UnsupportedOperationException e) {
                } catch (NotFoundException e2) {
                }
            }
            if (this.ॱॱ == null) {
                String ˏ = cwVar.ˏ(i);
                if (ˏ != null) {
                    this.ॱॱ = Typeface.create(ˏ, this.ʽ);
                }
            }
        } else if (cwVar.ᐝ(g.ॱי)) {
            this.ˏॱ = false;
            switch (cwVar.ॱ(g.ॱי, 1)) {
                case 1:
                    this.ॱॱ = Typeface.SANS_SERIF;
                    return;
                case 2:
                    this.ॱॱ = Typeface.SERIF;
                    return;
                case 3:
                    this.ॱॱ = Typeface.MONOSPACE;
                    return;
                default:
                    return;
            }
        }
    }

    void ˊ(WeakReference<TextView> weakReference, Typeface typeface) {
        if (this.ˏॱ) {
            this.ॱॱ = typeface;
            TextView textView = (TextView) weakReference.get();
            if (textView != null) {
                textView.setTypeface(typeface, this.ʽ);
            }
        }
    }

    public void ˋ(Context context, int i) {
        cw ˊ = cw.ˊ(context, i, g.ۥ);
        if (ˊ.ᐝ(g.ॱⁱ)) {
            ˊ(ˊ.ˋ(g.ॱⁱ, false));
        }
        if (VERSION.SDK_INT < 23 && ˊ.ᐝ(g.ॱߴ)) {
            ColorStateList ॱ = ˊ.ॱ(g.ॱߴ);
            if (ॱ != null) {
                this.ˊ.setTextColor(ॱ);
            }
        }
        if (ˊ.ᐝ(g.ॱʹ) && ˊ.ˎ(g.ॱʹ, -1) == 0) {
            this.ˊ.setTextSize(0, 0.0f);
        }
        ˊ(context, ˊ);
        ˊ.ॱ();
        if (this.ॱॱ != null) {
            this.ˊ.setTypeface(this.ॱॱ, this.ʽ);
        }
    }

    public void ˊ(boolean z) {
        this.ˊ.setAllCaps(z);
    }

    public void ˊ() {
        if (!(this.ॱ == null && this.ˎ == null && this.ˏ == null && this.ˋ == null)) {
            Drawable[] compoundDrawables = this.ˊ.getCompoundDrawables();
            ˏ(compoundDrawables[0], this.ॱ);
            ˏ(compoundDrawables[1], this.ˎ);
            ˏ(compoundDrawables[2], this.ˏ);
            ˏ(compoundDrawables[3], this.ˋ);
        }
        if (VERSION.SDK_INT < 17) {
            return;
        }
        if (this.ᐝ != null || this.ʻ != null) {
            compoundDrawables = this.ˊ.getCompoundDrawablesRelative();
            ˏ(compoundDrawables[0], this.ᐝ);
            ˏ(compoundDrawables[2], this.ʻ);
        }
    }

    private void ˏ(Drawable drawable, cu cuVar) {
        if (drawable != null && cuVar != null) {
            bx.ˏ(drawable, cuVar, this.ˊ.getDrawableState());
        }
    }

    private static cu ˎ(Context context, bx bxVar, int i) {
        ColorStateList ˋ = bxVar.ˋ(context, i);
        if (ˋ == null) {
            return null;
        }
        cu cuVar = new cu();
        cuVar.ˎ = true;
        cuVar.ˋ = ˋ;
        return cuVar;
    }

    @RestrictTo({RestrictTo.d.ˊ})
    public void ˏ(boolean z, int i, int i2, int i3, int i4) {
        if (!is.ॱ) {
            ˏ();
        }
    }

    @RestrictTo({RestrictTo.d.ˊ})
    public void ˊ(int i, float f) {
        if (!is.ॱ && !ˎ()) {
            ˏ(i, f);
        }
    }

    @RestrictTo({RestrictTo.d.ˊ})
    public void ˏ() {
        this.ʼ.ᐝ();
    }

    @RestrictTo({RestrictTo.d.ˊ})
    public boolean ˎ() {
        return this.ʼ.ॱॱ();
    }

    private void ˏ(int i, float f) {
        this.ʼ.ˎ(i, f);
    }

    public void ˋ(int i) {
        this.ʼ.ˊ(i);
    }

    public void ॱ(int i, int i2, int i3, int i4) throws IllegalArgumentException {
        this.ʼ.ˎ(i, i2, i3, i4);
    }

    public void ˎ(@NonNull int[] iArr, int i) throws IllegalArgumentException {
        this.ʼ.ॱ(iArr, i);
    }

    public int ˋ() {
        return this.ʼ.ˎ();
    }

    public int ॱ() {
        return this.ʼ.ॱ();
    }

    public int ॱॱ() {
        return this.ʼ.ˏ();
    }

    public int ᐝ() {
        return this.ʼ.ˋ();
    }

    public int[] ʻ() {
        return this.ʼ.ˊ();
    }
}
